import request from "@/utils/request";
import { OnlineTypeQuery, OnlineTypePageResult, OnlineTypeForm, OnlineType } from "./model";

/**
 * 板块分类API
 */
class OnlineTypeAPI {

  /**
   * 板块内容分类分页数据
   * @param queryParams 
   * @returns 
   */
  static getPage(queryParams?: OnlineTypeQuery) {
    return request<any, OnlineTypePageResult>({
      url:
        "/onlineType/getPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 获取板块分类列表
   * @param data 
   * @returns 
   */
  static getList(data: OnlineTypeQuery) {
    return request<any, OnlineType[]>({
      url: "/onlineType/getList",
      method: "post",
      data: data,
    });
  }


  /**
   * 新增板块分类
   * @param data 
   * @returns 
   */
  static add(data: OnlineTypeForm) {
    return request({
      url: "/onlineType/add",
      method: "post",
      data: data,
    });
  }
  /**
   * 修改板块分类
   * @param data 
   * @returns 
   */
  static update(data: OnlineTypeForm) {
    return request({
      url: "/onlineType/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除板块分类
   * @param data 
   * @returns 
   */
  static delete(data: OnlineTypeForm) {
    return request({
      url: "/onlineType/delete",
      method: "post",
      data: data,
    });
  }
}

export default OnlineTypeAPI;
